|
23 | 23 | - It contains QR codes or images containing external links.
|
24 | 24 | - It is not relevant to Mozilla's "{product}" product.
|
25 | 25 |
|
26 |
| -# Specific instructions |
| 26 | +# Instructions |
27 | 27 | Given a question, you must do the following:
|
28 | 28 | - Determine whether or not the question is spam by considering each of the spam cases
|
29 | 29 | listed above.
|
30 | 30 | - Provide a reason for your determination.
|
| 31 | +- Provide your level of confidence in the determination as an integer from 0 to 100, with |
| 32 | + 0 representing the lowest confidence and 100 the highest. |
31 | 33 |
|
32 | 34 | # Response format instructions
|
33 | 35 | {format_instructions}
|
|
48 | 50 | {topics}
|
49 | 51 | ```
|
50 | 52 |
|
51 |
| -# Specific instructions |
52 |
| -- Given a question, consider the title, description, and examples of each one of the |
53 |
| - eligible topics listed above, and then select the most relevant topic. |
| 53 | +# Instructions |
| 54 | +Given a question, you must do the following: |
| 55 | +- Consider the title, description, and examples (if provided) of each one of the eligible |
| 56 | + topics listed above, and then select the most relevant topic. |
54 | 57 | - If you conclude that the question does not relate to Mozilla's "{product}" product,
|
55 | 58 | or does not provide enough information to make a selection, select the "Undefined" topic.
|
56 | 59 | - Provide a reason for your selection.
|
|
67 | 70 | type="bool",
|
68 | 71 | description="A boolean that when true indicates that the question is spam.",
|
69 | 72 | ),
|
| 73 | + ResponseSchema( |
| 74 | + name="confidence", |
| 75 | + type="int", |
| 76 | + description=( |
| 77 | + "An integer from 0 to 100 that indicates the level of confidence in the" |
| 78 | + " determination of whether or not the question is spam, with 0 representing" |
| 79 | + " the lowest confidence and 100 the highest." |
| 80 | + ), |
| 81 | + ), |
70 | 82 | ResponseSchema(
|
71 | 83 | name="reason",
|
72 |
| - type="string", |
| 84 | + type="str", |
73 | 85 | description="The reason for identifying the question as spam or not spam.",
|
74 | 86 | ),
|
75 | 87 | )
|
|
80 | 92 | (
|
81 | 93 | ResponseSchema(
|
82 | 94 | name="topic",
|
83 |
| - type="string", |
84 |
| - description="The topic selected for the question.", |
| 95 | + type="str", |
| 96 | + description="The title of the topic selected for the question.", |
85 | 97 | ),
|
86 | 98 | ResponseSchema(
|
87 | 99 | name="reason",
|
88 |
| - type="string", |
| 100 | + type="str", |
89 | 101 | description="The reason for selecting the topic.",
|
90 | 102 | ),
|
91 | 103 | )
|
92 | 104 | )
|
93 | 105 |
|
94 | 106 |
|
95 |
| -spam_prompt = ChatPromptTemplate((("system", SPAM_INSTRUCTIONS), ("human", "{question}"))) |
| 107 | +spam_prompt = ChatPromptTemplate( |
| 108 | + ( |
| 109 | + ("system", SPAM_INSTRUCTIONS), |
| 110 | + ("human", "{question}"), |
| 111 | + ) |
| 112 | +).partial(format_instructions=spam_parser.get_format_instructions()) |
96 | 113 |
|
97 | 114 |
|
98 |
| -topic_prompt = ChatPromptTemplate((("system", TOPIC_INSTRUCTIONS), ("human", "{question}"))) |
| 115 | +topic_prompt = ChatPromptTemplate( |
| 116 | + ( |
| 117 | + ("system", TOPIC_INSTRUCTIONS), |
| 118 | + ("human", "{question}"), |
| 119 | + ) |
| 120 | +).partial(format_instructions=topic_parser.get_format_instructions()) |
0 commit comments